<!DOCTYPE html>
<html lang="en">
<include file="Public/header" title="新建制度" keywords="社团管理系统，常州大学，课程设计" />

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div method="get" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">制度标题</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="institutiontitle">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">制度内容</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="institutioncontent">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <button type="button" class="btn btn-w-m btn-info" id="subbtn">提交申请</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<include file="Public/footer"/>
<script>
    $(function () {
        $('#subbtn').on('click',function () {
            var institutiontitle = $('#institutiontitle').val();
            var institutioncontent = $('#institutioncontent').val();
            var param = {
                institutiontitle:institutiontitle,
                institutioncontent:institutioncontent,
            };
            console.log(param);
            if(!institutiontitle || !institutioncontent){
                alert('每一项都必须填写');
            }else{
                var url ="{:U('Institution/newinstitution')}";
                $.ajax({
                    url:url,
                    data:param,
                    dataType:'json',
                    type:'post',
                    success:function (data) {
                        alert(data.info);
                    },
                    error:function () {
                        alert('操作失败');
                    }
                })
            }
        })
    })
</script>
</html>
